package com.hsteach.framework.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.hsteach.common.utils.SecurityUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class MyMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        metaObject.setValue("createTime", new Date());
        metaObject.setValue("updateTime",new Date());
        metaObject.setValue("createBy", SecurityUtils.getAuthInfo().getPersonId());
    }



    @Override
    public void updateFill(MetaObject metaObject) {
        metaObject.setValue("updateTime",new Date());
        metaObject.setValue("updateBy", SecurityUtils.getAuthInfo().getPersonId());
    }
}
